package com.erpanderp.wam.usm.model.service.user;

import java.util.List;

import org.hibernate.Query;
import org.hibernate.Session;

import com.erpanderp.wam.usm.model.entity.user.Education;
import com.erpanderp.wam.util.HibernateUtil;

public class EducationDAO {
	
	 public List<Education> getEducations(Long newJoineeId)   {
			List<Education> education = null;
			
			try{
				Session session = HibernateUtil.getSessionFactory().getCurrentSession();			
				session.beginTransaction();
				
				String queryString = "from Education e where e.newJoinee.newJoineeId= :newJoineeId";
				
				Query query = session.createQuery(queryString);
				query.setCacheable(false).setLong("newJoineeId", newJoineeId);	
				education = (List<Education>) query.list();					
				session.close();
				return education;
				
			}catch(Exception e){
				e.printStackTrace();
				return null;
			}			
		}
	 

	 



}
